package com.sanji.sjmallmodule.goods;

import android.support.v4.app.Fragment;

/****
 * 用于懒加载
 *****/
public abstract class BaseFrament extends Fragment {
    protected boolean isVisible;



    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isVisibleToUser) {
            isVisible = true;
            onVisible();
        } else {
            isVisible = false;
            onInvisible();
        }
    }

    protected  void onVisible(){
        lazyLoadData();
    }

    public abstract void lazyLoadData();

    protected  void onInvisible(){}
}
